package com.eastfair.home.controller;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.service.HomeHomeServiceOrderService;
import com.eastfair.venueservice.dto.ServiceOrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 主场服务订单 REST API.
 *
 * @author dqq
 * @date 2023 /4/23
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/homeServiceOrder")
public class HomeHomeServiceOrderController {

    @Resource
    private HomeHomeServiceOrderService homeHomeServiceOrderService;

    /**
     * 发送配置收款商户的站内信.
     *
     * @param serviceOrder the service order
     * @return the r
     */
    @PostMapping("/send/config/payee/innerMsg")
    public R<Boolean>  sendConfigPayeeInnerMsg(@RequestBody ServiceOrderDTO serviceOrder) {
        log.info("sendConfigPayeeInnerMsg - 发送配置收款商户的站内信, serviceOrderDTO={}", serviceOrder);
        try {
            return R.successDef(homeHomeServiceOrderService.sendConfigPayeeInnerMsg(serviceOrder));
        } catch (BizException e) {
            return R.fail(e);
        }
    }
}